package com.hm.ipay.controller;

import com.hm.ipay.comm.aop.LoggerManage;
import com.hm.ipay.domain.result.ResponseData;
import com.hm.ipay.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class TransferController {
    @Autowired
    TransferService transferService;

    @RequestMapping(value = "/transfer", method = RequestMethod.POST)
    @LoggerManage(description = "转账")
    public ResponseData transfer(Long id, Long targetId, BigDecimal amount) {
        return transferService.transfer(id, targetId, amount);
    }

    @RequestMapping(value = "/switch_to_credit", method = RequestMethod.POST)
    @LoggerManage(description = "切换到信用账户")
    public ResponseData switchToCredit(Long id, BigDecimal amount) {
        return transferService.switchToCredit(id, amount);
    }
}
